﻿#ifndef DAWORKFLOWOPERATEWIDGET_H
#define DAWORKFLOWOPERATEWIDGET_H

#include <DAStandardGraphicsTextItem.h>
#include <QWidget>

namespace Ui
{
class DAWorkFlowOperateWidget;
}
class QUndoStack;

namespace DA
{
class DAProject;
class DADataWorkFlow;
class DAWorkFlowGraphicsScene;
class DAWorkFlowGraphicsView;
/**
 * @brief 绘图窗口
 */
class DAWorkFlowOperateWidget : public QWidget
{
    Q_OBJECT

public:
    DAWorkFlowOperateWidget(QWidget* parent = nullptr);
    ~DAWorkFlowOperateWidget();

    //设置工程
    void setProject(DAProject* project);
    //设置工厂
    void setNodeFactory(DADataWorkFlow* factory);
    //获取工作流操作视图
    DAWorkFlowGraphicsView* getWorkFlowGraphicsView() const;
    //获取GraphicsScene
    DAWorkFlowGraphicsScene* getWorkFlowGraphicsScene() const;
    //激活UndoStack
    void setUndoStackActive();
    //设置显示grid
    void setEnableShowGrid(bool on);
    //获取QUndoStack
    QUndoStack* getUndoStack();
    //运行工作流
    void runWorkFlow();
public slots:
    //添加一个背景图
    void addBackgroundPixmap(const QString& pixmapPath);
    //锁定背景图
    void setBackgroundPixmapLock(bool on);
    //文字加粗
    void setSelectTextToBold(bool on);
    //文字斜体
    void setSelectTextToItalic(bool on);
    //设置文字颜色
    void setSelectTextColor(const QColor& color);
    //设置字体样式
    void setSelectTextFamily(const QString& family);
    //设置字体大小
    void setTextSize(const int size);
    //背景图位移
    // void onItemPosChange(const QPointF& oldPos, const QPointF& newPos);

private:
    QList< DAStandardGraphicsTextItem* > getSelectTextItems();

private:
    Ui::DAWorkFlowOperateWidget* ui;
};
}  // namespace DA
#endif  // DAWORKFLOWOPERATEWIDGET_H
